package com.nd.qa.shareplate.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.nd.qa.shareplate.IDao.ShareDeviceMapper;
import com.nd.qa.shareplate.model.ShareDevice;
import com.nd.qa.shareplate.service.ShareDeviceService;

@Service("com.nd.qa.shareplate.service.ShareDeviceService")
public class ShareDeviceServiceImpl implements ShareDeviceService {

	@Autowired
	private ShareDeviceMapper shareDeviceMapper;
	
	@Override
	public ShareDevice queryFreeDevices(ShareDevice shareDevice) {
		List<ShareDevice> devices = shareDeviceMapper.queryFreeDevices(shareDevice);
		if (devices.size()>0) {
			return devices.get(0);
		}
		return null;
	}

	@Override
	public int updateDeviceStatus(ShareDevice shareDevice) {
		int code = shareDeviceMapper.updateDeviceStatus(shareDevice);
		return code;
	}

}
